package org.gd.science.qr.frame;

import org.gd.science.qr.qrgen.QRCodeGenerator;

import javax.swing.*;
import java.awt.*;

public class QRPanel extends JPanel implements QRInterface {

    public QRPanel init() {
        setMinimumSize(DEFAULT_SIZE);
        setSize(DEFAULT_SIZE);
        return this;
    }

    @Override
    protected void paintComponent(Graphics g) {
        super.paintComponent(g);
        new QRCodeGenerator()
                .setText("Привет, Рома! Как дела? ))")
                .setBgColor(Color.YELLOW)
                .setFgColor(Color.BLACK)
                .setEncoding("UTF-8")
                .writeTo(g);
    }
}
